// const loadModule = (cb) => (componentModule) => {
//   cb(null, componentModule.default);
// };

// const errorLoading = (err) => {
//   console.error('Dynamic page loading failed', err); // eslint-disable-line no-console
// };

export default () => {

  return [
    {
      path: 'explore',
      getComponent(nextState, cb) {
        require.ensure([], (require) => {
          cb(null, require('./components/Explore'))
        })
      }
    },   
    {
      path: 'posts',
      getComponent(nextState, cb) {
        require.ensure([], (require) => {
          cb(null, require('./containers/PostList/PostList'))
        })
      }
    }, 
    {
      path: 'login',
      getComponent(nextState, cb) {
        require.ensure([], (require) => {
          cb(null, require('./containers/Login/Login'))
        })
      }
    }, 
    {
      path: 'register',
      getComponent(nextState, cb) {
        require.ensure([], (require) => {
          cb(null, require('./containers/Register/Register'))
        })
      }
    }, 
    // This route is the same as the one in "react-boilerplate", but "System.import" reports erroer, still working on this.
    // {
    //   path: 'explore',
    //   getComponent(nextState, cb) {
    //     System.import('components/Explore')
    //       .then(loadModule(cb))
    //       .catch(errorLoading);
    //   },
    // }, 
  ]
}


